package com.taobao.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.taobao.common.bean.EZUIResult;
import com.taobao.mapper.TbItemMapper;
import com.taobao.pojo.TbItem;
import com.taobao.pojo.TbItemExample;
import com.taobao.service.IItemService;
@Service
public class ItemService implements IItemService {
	@Autowired
	TbItemMapper itemMapper;
	
	@Override
	public EZUIResult getItemList(Integer page, Integer rows) {
		TbItemExample example = new TbItemExample();
		PageHelper.startPage(page, rows);
		List<TbItem> items = itemMapper.selectByExample(example);
		PageInfo<TbItem> pageInfo = new PageInfo<>(items);
		long total = pageInfo.getTotal();
		EZUIResult ezuiResult = new EZUIResult(total, items);
		return ezuiResult;
	}


}
